]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
status/keyboard: Preserve MRU order while IBus is disabled
authorMaksim Mazko <undeparg@gmail.com>
Mon, 2 Mar 2026 17:44:56 +0000 (20:44 +0300)
committerFlorian Müllner <fmuellner@gnome.org>
Sat, 14 Mar 2026 17:49:19 +0000 (18:49 +0100)
In password fields, IBus sources are temporarily disabled and a backup
of the MRU list is created. If the user switches layouts in that state,
the active MRU list is updated, but the backup is not.

When IBus is enabled again, the stale backup is restored and the order
the user just selected is lost. Sync the backup on interactive source
switches while IBus is disabled, so the MRU order stays consistent.

Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/8538
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/4101>
(cherry picked from commit 8e0f850edc03ada8f79ef68412eabb05c5f76d02)

js/ui/status/keyboard.js

index 81e2d5daf0c1bc1bd7f15bdbd2a2195c2a4f5a27..964e6eed87b31223136067e4b5727beeb70d331f 100644 (file)
@@ -481,7 +481,7 @@ export class InputSourceManager extends Signals.EventEmitter {
         this._settings.mruSources = sourcesList;
     }
 
-    _currentInputSourceChanged(newSource) {
+    _currentInputSourceChanged(newSource, interactive) {
         let oldSource;
         [oldSource, this._currentSource] = [this._currentSource, newSource];
 
@@ -492,6 +492,16 @@ export class InputSourceManager extends Signals.EventEmitter {
             ...this._mruSources.filter(s => s !== newSource),
         ];
 
+        // Only track user-initiated switches in backup MRU.
+        // Internal (non-interactive) activations during reload/reapply must not affect restore order.
+        if (interactive && this._disableIBus && this._mruSourcesBackup) {
+            this._mruSourcesBackup = [
+                newSource,
+                ...this._mruSourcesBackup.filter(
+                    s => s.type !== newSource.type || s.id !== newSource.id),
+            ];
+        }
+
         this._changePerWindowSource();
     }
 
@@ -522,7 +532,7 @@ export class InputSourceManager extends Signals.EventEmitter {
                 KeyboardManager.releaseKeyboard();
         });
 
-        this._currentInputSourceChanged(is);
+        this._currentInputSourceChanged(is, interactive);
 
         if (interactive)
             this._updateMruSettings();